<template>
    <div>
        <div class="hd">
            <TypeNav :typeitem="typeitem" @typeItemClick="typeItemClick"/>
        </div>
        <div class="bd" v-if="newalbum.length != 0">
            <AlbumTable :albumlist="newalbum"/>
        </div>
    </div>
</template>
<script>
import TypeNav from './TypeNav.vue'
import AlbumTable from '@/components/content/albumlist/AlbumTable.vue';

export default {
    name: "",
    components: { TypeNav, AlbumTable },
    data() {
        return {
            typeitem :[
				{ type: "全部", code: "ALL" },
				{ type: "华语", code: "ZH" },
				{ type: "欧美", code: "EA" },
				{ type: "日本", code: "JP" },
				{ type: "韩国", code: "KR" },
			],
            area:'ALL',// 默认查询全部
            currentPage:1,// 默认从第一页
            pageSize:50,// 默认查询50条
            newalbum:[],
            total:0
        };
    },
    created() {
        this.getNewAlbumBy();
    },
    methods: {
        async getNewAlbumBy(){
            let offset= (this.currentPage - 1) * this.pageSize;
            let resNewAlbum =  await this.$API.newsongs.getNewAlbum(this.area,offset);
            if(resNewAlbum.code == 200){
                this.newalbum = resNewAlbum.albums;
                this.total = resNewAlbum.total
            }
        },
        typeItemClick(code){
            this.currentPage = 1;
            this.area = code;
            this.getNewAlbumBy();

        }
    }, 
}
</script>
<style lang="less" scoped>
    
</style>